//#define _CRT_SECURE_NO_WARNINGS
//#include <stdio.h>
//#include <string.h>
//struct stu
//{
//	int age;
//	char name[20];
//};
//int stu_cmp_by_name(const void* p1, const void* p2)
//{
//	return strcmp(((struct stu*)p1)->name, ((struct stu*)p2)->name);
//}
//int main()
//{
//	struct stu arr[] = { {18,"xianghao"},{15,"zhengyi"},{19,"wangchengyu"} };
//	qsort(arr, sizeof(arr) / sizeof(arr[0]), sizeof(arr[0]), stu_cmp_by_name);
//
//}
#include <stdio.h>
void swap(char* p1, char* p2, int sz)
{
	for (int i = 0; i < sz; i++)
	{
		char tmp = *p1;
		*p1 = *p2;
		*p2 = tmp;
		p1++;
		p2++;
	}
}
void my_qsort(void* str, size_t num, size_t size, int (*p)(const void*, const void*))
{
	for (int i = 0; i < num - 1; i++)
	{
		for (int j = 0; j < num - 1 - i; j++)
		{
			if (p((char*)str + j * size, (char*)str + (j + 1) * size) > 0)
			{
				swap((char*)str + j * size, (char*)str + (j + 1) * size, size);
			}
		}
	}
}